Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
Base automatically changed from
graveland/rolling-update-message-order
to
main
November 25, 2026 00:39
graveland
force-pushed
the
graveland/rollout-progress-under-refusals
branch
from
November 25, 2026 03:08
34975e3 to
f832b1b
Compare
This comment has been minimized.
This comment has been minimized.
graveland
force-pushed
the
graveland/rollout-progress-under-refusals
branch
from
November 25, 2026 13:53
f832b1b to
4544e1b
Compare
This comment has been minimized.
This comment has been minimized.
graveland
force-pushed
the
graveland/rollout-progress-under-refusals
branch
from
November 25, 2026 14:53
4544e1b to
40948b5
Compare
This comment has been minimized.
This comment has been minimized.
graveland
force-pushed
the
graveland/rollout-progress-under-refusals
branch
from
November 25, 2026 16:31
1adc138 to
efcbe48
Compare
This comment has been minimized.
This comment has been minimized.
graveland
force-pushed
the
graveland/rollout-progress-under-refusals
branch
from
November 25, 2026 18:29
efcbe48 to
69231ec
Compare
This comment has been minimized.
This comment has been minimized.
graveland
force-pushed
the
graveland/rollout-progress-under-refusals
branch
from
November 25, 2026 19:19
69231ec to
a4a8958
Compare
This comment has been minimized.
This comment has been minimized.
A rollout replaces a shard's pool pods one at a time, and each removal must pass the posture check against an observation of the shard. The first refusal ended the pass: the rolling-update path returned on the first refused pod of a pool/cell, scale-down tried only its top-ranked extra, and a refusal in one pool stopped every pool after it. Most refusals are about the pod being removed, not the shard. With a follower the primary does not report connected, every other removal is refused because that follower would be among the survivors, and the follower itself, the one pod that may be removed and whose replacement reconnects, was never tried when it came later in the order. The rollout then stalled for as long as the condition lasted. Pool maintenance no longer decides disruptions. It records which pool/cells ask for one (a filesystem-resize restart, a scale-down, a rolling update), and startDisruption decides once per pass for the whole shard, after pool maintenance and the data plane phase have both completed: it reads the pool pods uncached, observes the data plane once, checks every candidate against that one observation, requests the drain of the first candidate allowed and stops, whether or not the write succeeded. A pass in which no pool/cell asks reads nothing. Pool maintenance is otherwise unchanged: pools in map order, and a pool or cell error ends the pass before the walk. The rules each path applied are unchanged and are evaluated from the same snapshot: nothing starts while a pool pod drains or terminates or a mounted PVC is being deleted; a pod stranded on a previous global topology is drained without the posture check; drifted not-Ready pods are replaced while desired pods exist and those on the desired spec are Ready and serving; Ready pods, extras and resize restarts wait for a healthy shard with no desired pod missing; scale-down keeps its ranking and its deferral; maintenance capacity is required. The order between kinds is the one maintenance works in and now holds across the shard, not within a pool: resize restarts, the shard's extras, drifted replicas, then the primary. On the Ready path the primary is switched over only once no other desired pod is drifted anywhere in the shard. Every gate, count, candidate and target of the walk is over one set of pods, the pool pods the shard manages: controlled by the shard, carrying their pool/cell's selector labels, and named as those labels and their ordinal give. Pool maintenance, the maintenance surge and the drain state machine reduce what they list to the same set, so a pod that merely carries the labels cannot hold a gate, supply capacity, suppress a surge, or be written to. The data plane is still observed on every labelled pod: a cohort member is one whoever controls its pod. A pod maintenance lists and does not manage is named in the RollingUpdate condition while anything is waiting, sorted and capped so the message is the same on every pass. When it holds a desired pod's name, maintenance does not try to create over it, and the condition reports the pod as the reason the rollout is blocked. A request is acted on only while it still describes the shard. The drain request is written against the pod as the walk read it (the patch carries that read's resourceVersion). The Shard is read from the API server before the write and again after it, and a drain requested under a spec that has since changed is withdrawn; the surge the not-Ready path asks for is preceded by the same read. A resize request names its pod by UID and the PVC is read again from the API server. A restart for a filesystem resize records its reason in a drain.multigres.com/reason annotation, without which the drain state machine cancelled it as a drain on a pod already on the desired spec; the value names the pod by UID and counts only while that pod's data PVC still waits for the restart, read uncached, and a failed read neither cancels nor advances the drain. A drain step whose write fails is returned as an error, since no watch event follows a write that did not happen. A quarantine wipe reserves the pass, so the walk, which now runs after it, starts nothing in the same pass. The first refusal, in candidate order, is reported in the RollingUpdate condition as RolloutBlocked for the Ready path too, and the DisruptionBlocked Event is emitted when that reason changes rather than on every pass. The condition is written after the walk, a pass whose drain write failed included, and published only when it changed. Waits are no longer polled on fixed intervals. A wait that ends in a Pod or PVC watch event (a drain requested or in progress, a pod or PVC being deleted, a pod created and not yet Ready) is left to that event: the 2s requeue after each drain step and the 5s requeue while a disruption is in flight are removed. Such a pass asks only for a backstop requeue, 6m to 9m out with jitter, longer than the drain timeout so the backstop pass is the one that times a stuck drain out. A refusal only a pooler RPC can show the end of (a posture refusal, an unobservable data plane) is polled on the readiness backoff, from 5s to 1m by how long that refusal has lasted for the shard, in place of the fixed 5s and 30s retries; a pass that stops before the checks does not start that backoff over. rolloutRequeue is the one place these become the pass's RequeueAfter. Signed-off-by: Brent Graveland <graveland@supabase.io>
graveland
force-pushed
the
graveland/rollout-progress-under-refusals
branch
from
November 25, 2026 20:35
a4a8958 to
5729557
Compare
graveland
marked this pull request as ready for review
November 25, 2026 20:40
This comment has been minimized.
This comment has been minimized.
A reconcile can update the MultigresCluster between the scenario read and write. Reuse the fixture conflict retry for both policy mutations, returning errors through the script without relaxing its assertions. Signed-off-by: Brent Graveland <graveland@supabase.io>
🔬 Go Test Coverage ReportSummary
Status✅ PASS DetailShow New Coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Diff: 50% test, 50% code, <1% docs (4,464 lines changed)
A rollout replaces a shard's pool pods one at a time, and each removal must pass a posture check against an observation of the data plane. On main the first refusal ends the pass. Most refusals are about the pod being removed, not the shard: when the primary does not report one follower as connected, every other removal is refused, because that follower would be among the survivors. The follower itself may be removed, but later in the order it is never tried, and the rollout stalls.
Fix
One rule: observe once, check every candidate against that one observation, act on the first one it allows, and stop.
Pool maintenance no longer decides disruptions; it records which pool/cells ask for one, and is otherwise as on main (a pool error still ends the pass).
startDisruptiondecides once per pass for the whole shard, after maintenance and the data plane phase completed, in one order: resize restarts, extras, drifted replicas, and the primary only once no other pod is drifted. Every other rule on these paths is main's, evaluated from the one snapshot.The drain request is bound to the pod as it was read (resourceVersion) and to the Shard generation, read from the API server around the write. A resize restart is bound to its pod's UID and to a resize still pending.
The walk's gates, counts and targets are over the pool pods the shard controls. A pod that only carries the labels is ignored and named in the RollingUpdate condition while anything is waiting.
A wait that a Pod or PVC watch event ends is left to the event, with a backstop requeue 6 to 9 minutes out. A refusal only a pooler RPC can show the end of is polled on a backoff from 5s to about 1m.
Tests
Unit tests are table rows on one runner through real pool maintenance and the walk: candidate order, gates, the managed-pod set, the write, and the requeue policy. Three suite scenarios cover what needs the real controllers: a rollout and a scale-down reaching the removable pod past refused ones, and a scale-down in one pool with an image change in another. The PVC deletion policy scenario retries Kubernetes update conflicts on both policy changes without relaxing its PVC assertions.
Risks
A Ready-path refusal is now reported as
RolloutBlockedinstead ofPodsDrifted. A resize restart sets adrain.multigres.com/reasonannotation. A pod that carries a pool's labels without being controlled by the shard is ignored, where main managed it as its own; one that holds a desired pod's name blocks the rollout until it is deleted, and the condition says so. A missed watch event costs up to 9 minutes rather than seconds. A separate change may let one pool's error not block others.